
CC := gcc -c
CPP := g++ -c
CXX := g++ -c
LD := g++

CFLAGS += \
    -O0 -g -Wall -fmessage-length=0

CPPFLAGS += \
    -O0 -g -Wall -fmessage-length=0

CXXFLAGS += \
    -O0 -g -Wall -fmessage-length=0 -std=c++0x

LDFLAGS += \
    -lpthread

OBJS =	$(patsubst %.c,%.c.o,$(wildcard *.c)) \
        $(patsubst %.cpp,%.cpp.o,$(wildcard *.cpp)) \
        $(patsubst %.cxx,%.cxx.o,$(wildcard *.cxx))

TARGET := file_server file_client

all:$(TARGET)

file_server: $(filter-out file-client%,$(OBJS))
	$(LD) $^ $(LDFLAGS) $(OUTPUT_OPTION)

file_client: $(filter-out file-server%,$(OBJS))
	$(LD) $^ $(LDFLAGS) $(OUTPUT_OPTION)

%.c.o: %.c
	$(CC) $(CFLAGS) $< $(OUTPUT_OPTION)

%.cpp.o: %.cpp
	$(CPP) $(CPPFLAGS) $< $(OUTPUT_OPTION)

%.cxx.o: %.cxx
	$(CXX) $(CXXFLAGS) $< $(OUTPUT_OPTION)

%.c:

%.cpp:

%.cxx:

clean:
	rm -f $(OBJS) $(TARGET)
